function t(t, e) {
    if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
}

Object.defineProperty(exports, "__esModule", {
    value: !0
});

var e = Object.assign || function(t) {
    for (var e = 1; e < arguments.length; e++) {
        var n = arguments[e];
        for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (t[a] = n[a]);
    }
    return t;
}, n = function() {
    function t(t, e) {
        for (var n = 0; n < e.length; n++) {
            var a = e[n];
            a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), 
            Object.defineProperty(t, a.key, a);
        }
    }
    return function(e, n, a) {
        return n && t(e.prototype, n), a && t(e, a), e;
    };
}();

exports.default = function(t) {
    var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
    return new r(t, e({
        scope: "modalview"
    }, n)).show();
};

var a = {
    title: "",
    subtitle: "",
    modalData: [],
    buttons: [ {
        text: "知道了",
        tap: function() {}
    } ]
}, r = exports.ModalView = function() {
    function r(n, o) {
        var i = this;
        t(this, r), this.page = n, this.scope = o.scope;
        var s = e({}, a, o);
        return s.buttons.forEach(function(t) {
            t.type = t.type || "primary";
        }), n.$setData(o.scope, {
            modalData: s
        }), Object.assign(n, {
            $$buttonTapped: function(t) {
                var e = t.currentTarget.dataset.index, n = s.buttons[e].tap;
                ("function" == typeof n && !1 !== n() || !n) && i.hide();
            }
        }), this;
    }
    return n(r, [ {
        key: "show",
        value: function() {
            var t = this.scope;
            return this.page.$setData(t, {
                showModalStatus: !0
            }), this;
        }
    }, {
        key: "hide",
        value: function() {
            var t = this.scope;
            return this.page.$setData(t, {
                showModalStatus: !1
            }), this;
        }
    } ]), r;
}();